<div class="page-header">
  <h1>Listagem <small>Anexos</small></h1>
</div>

<ul class="breadcrumb">
  <li><a href="<?php echo $this->baseUrl() ?>/index">Home</a> <span class="divider">/</span></li>
  <li><a href="<?php echo $this->baseUrl() ?>/cliente/listar">Listar Clientes</a> <span class="divider">/</span></li>
  <li><a href="<?php echo $this->baseUrl() ?>/cliente/show/id/<?php echo $this->idCliente ?>">Detalhes do Cliente</a> <span class="divider">/</span></li>
  <li class="active">Listar Anexos</li>
</ul>

<?php if (!empty($this->msg)): ?>
<div class="alert alert-success alert-dismissable">
  <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
  <?php echo $this->msg; ?>
</div>
<?php endif; ?> 

<table class="table table-hover">
    <thead>
    <th>#</th>
    <th>Parcela</th>
    <th>Nome Anexo</th>
    <th></th>
    </thead>
    <tbody>
        <?php foreach ($this->anexos as $anexo): ?>
        <tr>
            <td><?php echo $anexo->id ?></td>
            <td><?php echo $anexo->parcela ?></td>
            <td><a href="javascript:abrir('<?php echo $this->baseUrl() ?>/emprestimo/ver-arquivo/id/<?php echo $anexo->id ?>')" target="_blank" ><?php echo $anexo->nome_arquivo ?></a></td>
            <td>
            <?php if ($this->session->role == Role::ADMINISTRADOR): ?>
                <a href="#modal-excluir-anexo-<?php echo $anexo->id?>" role="button" data-toggle="modal" class="icon-trash" title="Excluir"></a>
                <?php echo $this->partial('partials/modal-excluir-anexo.phtml', array('anexo' => $anexo)); ?>
            <?php endif ?>
            </td>            
        </tr>
        <?php endforeach; ?>
       
    </tbody>
</table>

<script language="JavaScript"> function abrir(URL) {  var width = 500;  var height = 500;  var left = 250;  var top = 60;  window.open(URL,'janela', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=yes, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no'); } </script> 
